package com.example.shirodemo.config.thymeleaf;

import java.util.HashSet;
import java.util.Set;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;

/**
 * @author 绫小路
 * @date 2021/1/14 22:43
 * @description
 */
public class ShiroDialect extends AbstractProcessorDialect {

  private static final String DIALECT_NAME = "shiro方言";

  public ShiroDialect() {
    // We will set this dialect the same "dialect processor" precedence as
    // the Standard Dialect, so that processor executions can interleave.
    super(DIALECT_NAME, "th", StandardDialect.PROCESSOR_PRECEDENCE);
  }

  @Override
  public Set<IProcessor> getProcessors(String s) {
    final Set<IProcessor> processors = new HashSet<>();
    processors.add(new AuthTagProcessor(s));
    return processors;
  }
}
